/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       bool_array.h

	$Header: /game/bool_array.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef BOOL_ARRAY_H_INCLUDED
#define BOOL_ARRAY_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <iosfwd>
#include <vector>

class t_bool_array : public std::vector<int>
{
public:
	bool read( std::streambuf& stream );
	bool write( std::streambuf& stream ) const;

	int& operator[]( int arg );
	int  operator[]( int arg ) const;
};

inline int& t_bool_array::operator[]( int arg )
{
	if (arg >= (int)size())
		insert( end(), arg - size() + 1, 0 );
	return *(begin() + arg);
}

inline int t_bool_array::operator[]( int arg ) const
{
	if (arg >= (int)size())
		return 0;
	return *(begin() + arg);
}


#endif // BOOL_ARRAY_H_INCLUDED